#coding:utf-8
players = ['charles', 'martina', 'michae', 'florence', 'eli']
print(players[0:3])
print(players[1:4])
print(players[:4])
print(players[2:])
print(players[-3:])

#遍历切片
players = ['charles', 'martina', 'michae', 'florence', 'eli']
print("Here are the first three players on my team:")
for players in players[:3]:
    print(players.title())

#复制列表
my_foods = ['pizza', 'falafel', 'carrot', 'carrot cake']
friend_foods = my_foods[:]

#这里是直接赋值 和切片的输出是一样，但是意义不一样
friend_foods = my_foods

#添加食品
my_foods.append('cannoli')
friend_foods.append('ice cream')

print("\nMy favorite foods are:")
print(my_foods)

print("\nMy friend's favorite foods are:")
print(friend_foods)

